package com.dzm.controller;


import com.alibaba.excel.EasyExcel;
import com.dzm.common.result.R;
import com.dzm.entity.Student;
import com.dzm.service.IStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Dzm
 * @since 2024-08-28
 */
@RestController
@RequestMapping("/student")
public class StudentController {

    @Autowired
    private IStudentService studentService;

    @GetMapping("/easyexcel")
    public R test() {
        List<Student> list = studentService.list();

        String fileName = "D:\\BaiduNetdiskDownload\\test.xls";
        EasyExcel.write(fileName, Student.class).sheet().doWrite(list);
        return R.ok();
    }
}
